import type Api from '#/typings/common';

import { requestClient } from '#/api/request';

export namespace SystemLogApi {
  export interface SystemLogAction {
    [key: string]: any;
    id: number;
    status: 0 | 1;
  }

  export interface SystemLogLogin {
    [key: string]: any;
    children?: SystemLogAction[];
    id: number;
    name: string;
    remark?: string;
    status: 0 | 1;
  }
}

/**
 * 获取操作日志分页列表
 */
async function getActionLogPageList(params: Api.Common.PageParams) {
  return requestClient.get<Array<SystemLogApi.SystemLogAction>>(
    'sys/logger/oper/list',
    { params },
  );
}

/**
 * 获取登陆日志分页列表
 * @returns
 */
async function getLoginLogPageList(params: Api.Common.PageParams) {
  return requestClient.get<Array<SystemLogApi.SystemLogLogin>>(
    'sys/logger/login/list',
    { params },
  );
}

export { getActionLogPageList, getLoginLogPageList };
